package org.wmq.housemodel.entity;

import org.wmq.housemodel.enums.ResultCode;

public class Result<T> {
    private Result(){}
    private ResultCode code;
    private String message;
    private T data;
    private Result(ResultCode code,String message,T data){
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public static <T> Result<T> ok(T data){
        return new Result<>(ResultCode.SUCCESS,"操作成功",data);
    }
    public static Result<Void> ok(){
        return ok(null);
    }
    public static Result<Void> error(String message){
        return new Result<>(ResultCode.ERROR,message,null);
    }
}
